<?php

namespace app\admin\validate;
use think\Validate;

class login extends Validate
{
    protected $rule = [
        'username'=>'require|max:11|phone',
        'password'=>'require|password',
        'code'=>'require|captcha',
    ];
    protected $message = [
        'username.require'=>'请输入用户名',
        'username.max'=>'手机号不能超过11位',
        'username.phone'=>'手机号格式不正确',
        'username.unique'=>'手机号已存在',
        'code.require'=>'验证码不能为空',
        'code.captcha'=>'验证码不正确',
        'password.require'=>'请输入密码',
        'password.password'=>'密码长度不能超过32位低于6位',
    ];

    protected $regex = [
        'phone'    => '/^1[3-8]{1}[0-9]{9}$/',
        'password'  => '/^[\w]{6,32}$/'
    ];
}